extends Node2D

class_name Bullet

export (int) var speed = 50
export (int) var damage = 100
export (int) var bounce = 1
export (int) var air_time = 3
export (int) var penetration = 1
export (CircleShape2D) var damage_radius

var direction = Vector2()
var velocity = Vector2()

func _physics_process(delta):
	_phy_proc(delta)

func _phy_proc(delta):
	if air_time > 0:
		air_time -= delta
	else:
		queue_free()
	velocity = speed * delta * direction
	position += velocity
	
	rotation = direction.angle()

func get_sprite() -> Texture:
	 return $AnimatedSprite.frames.get_frame("default", 0)
